package com.webex.ta.hydra.hamal;

import com.webex.ta.hydra.hamal.iface.CommandResult;
import com.webex.ta.hydra.hamal.iface.Hamal;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.TException;

/**
 * Created by IntelliJ IDEA.
 * User: vegaz
 * Date: 2010-4-23
 * Time: 12:52:20
 * To change this template use File | Settings | File Templates.
 */
public class Main {

    private static void print(CommandResult r) {
        System.out.println(r.getStatuscode());
        System.out.println(r.getStatustext());
    }

    public static void main(String args[]) throws TException {
        TTransport tr = new TSocket("10.224.105.192", 9090);
        tr.open();
        TProtocol proto = new TBinaryProtocol(tr);
        Hamal.Client client = new Hamal.Client(proto);
        CommandResult r;
        r = client.launchapp("AriesX");
        print(r);
        r = client.execute("activate", "AriesX", "");
        print(r);
        client.execute("setvalue", "windows['Aries X'].groups[1].text_fields[1]", "");
        client.execute("setvalue", "windows['Aries X'].groups[1].text_fields[3]", "");
        client.execute("click", "windows['Aries X'].groups[1].text_fields[1]", "");
        client.execute("keystroke", "windows['Aries X'].groups[1].text_fields[1]", "vegaz@sz.webex.com");
        client.execute("click", "windows['Aries X'].groups[1].text_fields[3]", "");
        client.execute("keystroke", "windows['Aries X'].groups[1].text_fields[3]", "P@ssword123");
        client.execute("click", "windows['Aries X'].buttons[2]", "");
        r = client.execute("gettitle", "windows['Ride the Sheepony']", "");
        print(r);
//        r = client.execute("rightclick", "windows['Ride the Sheepony'].splitter_groups[1].scroll_areas[1].outlines[1].rows[3]", "");
//        print(r);
    }
}
